@extends('/model/goods')
@section('title','商品分类展示')
@section('content')

<style type="text/css">
 .pages li {
    cursor: pointer;
    display: block;
    float: left;
    outline: medium none;
    text-align: center;
    text-decoration: none;
}
.pages a {
    border: 1px solid #cccccc;
    border-radius: 2px;
    color: #666666;
    display: inline-block;
    font-size: 16px;
    height: 36px;
    line-height: 36px;
    margin: 0 4px;
    overflow: hidden;
    padding: 0 12px;
    text-align: center;
}               
</style>
<div class="i_bg"> 
    <div class="content mar_20">
    	<div class="l_history">
        	<div class="his_t">
            	<span class="fl">浏览历史</span>
                <span class="fr"><a href="" id='clearhistory'>清空</a></span>
            </div>
        	<ul id='history' class='display'>
            <!-- 商品浏览历史 -->
        	</ul>
        </div>
        <div class="l_list">
        	<table border="0" style="width:100%; margin-bottom:30px; border:1px solid #eaeaea;" cellspacing="0" cellpadding="0">
              <tr valign="top">
                <td width="248"><div class="brand_img"><img src="@if(!empty($goodslist[0]['picbrand'])) {{$goodslist[0]['picbrand']}} @else /upload/1.jpg @endif" width="226" height="108" /></div></td>
                <td class="td_b" style="padding:15px 40px;">
                <script type="text/javascript">

                    //获取商品总类别id
                    var id = {{$typeid}};

                    $.get('/typelist',{id:id},function(data)
                    {
                        var str = '';
                        // console.log(data);
                        for (var i = 0; i < data.length; i++) {
                            str +=  "<a href='/typegoodslist?id="+data[i].id+"' class='now'>"+data[i].name+"</a>";
                        };

                        // console.log(str);
                        $("span[name=alltype]").html(str);
                    },'json');

                </script>
                	所有分类<br /><span name="alltype">
                    <!-- 所有子分类 -->
                </span></td>
              </tr>
            </table>
        	<div class="list_t">
            	<span class="fl list_or">
                	<a href="#" class="now">默认</a>
                    <a href="#">
                    	<span class="fl">销量</span>                        
                        <span class="i_up">销量从低到高显示</span>
                        <span class="i_down">销量从高到低显示</span>                                                     
                    </a>
                    <a href="#">
                    	<span class="fl">价格</span>                        
                        <span class="i_up">价格从低到高显示</span>
                        <span class="i_down">价格从高到低显示</span>     
                    </a>
                    <a href="#">新品</a>
                </span>
                <span class="fr">共发现120件</span>
            </div>
            <div class="list_c">
            	
                <ul class="cate_list">
                @foreach($goodslist as $value)
                	<li>
                    	<div class="img"><a href="/product?id={{$value['id']}}"><img src="{{$value['picname']}}" width="210" height="185" /></a></div>
                        <div class="price">
                            <font>￥<span>{{$value['price']}}.00</span></font> &nbsp; {{$value['desc']}}
                        </div>
                        <div class="name"><a href="/product?id={{$value['id']}}">{{$value['goods']}}</a></div>
                        <div class="carbg">
                        	<a href="#" class="ss">收藏</a>
                            <a href="" name='j_car' class="j_car">加入购物车</a>
                        </div>
                    </li>
                @endforeach 
                </ul>
            <div class="pages">
                {!! $goodslist->appends(['id'=>"$typeid"])->render() !!}
            
            </div>
            <!-- 点击添加购物车 -->
            <script type="text/javascript">


            </script>
        </div>
    </div>
@endsection
